<?php

/**
 * Magzine filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMagzineFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'          => new sfWidgetFormFilterInput(),
      'tag'            => new sfWidgetFormFilterInput(),
      'author'         => new sfWidgetFormFilterInput(),
      'magzine_no'     => new sfWidgetFormFilterInput(),
      'publish_time'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'create_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'hit_i'          => new sfWidgetFormFilterInput(),
      'hit_mask_i'     => new sfWidgetFormFilterInput(),
      'brief'          => new sfWidgetFormFilterInput(),
      'keyword'        => new sfWidgetFormFilterInput(),
      'status_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'member_level_i' => new sfWidgetFormFilterInput(),
      'content_type_i' => new sfWidgetFormFilterInput(),
      'body'           => new sfWidgetFormFilterInput(),
      'flash_link'     => new sfWidgetFormFilterInput(),
      'snapshot'       => new sfWidgetFormFilterInput(),
      'snapshot_home'  => new sfWidgetFormFilterInput(),
      'photo_group_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Photogroup'), 'add_empty' => true)),
      'system_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'title'          => new sfValidatorPass(array('required' => false)),
      'tag'            => new sfValidatorPass(array('required' => false)),
      'author'         => new sfValidatorPass(array('required' => false)),
      'magzine_no'     => new sfValidatorPass(array('required' => false)),
      'publish_time'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'create_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'hit_i'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'hit_mask_i'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'brief'          => new sfValidatorPass(array('required' => false)),
      'keyword'        => new sfValidatorPass(array('required' => false)),
      'status_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Status'), 'column' => 'status_id')),
      'member_level_i' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'content_type_i' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'body'           => new sfValidatorPass(array('required' => false)),
      'flash_link'     => new sfValidatorPass(array('required' => false)),
      'snapshot'       => new sfValidatorPass(array('required' => false)),
      'snapshot_home'  => new sfValidatorPass(array('required' => false)),
      'photo_group_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Photogroup'), 'column' => 'photo_group_id')),
      'system_user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Systemuser'), 'column' => 'system_user_id')),
    ));

    $this->widgetSchema->setNameFormat('magzine_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Magzine';
  }

  public function getFields()
  {
    return array(
      'magzine_id'     => 'Number',
      'title'          => 'Text',
      'tag'            => 'Text',
      'author'         => 'Text',
      'magzine_no'     => 'Text',
      'publish_time'   => 'Date',
      'create_time'    => 'Date',
      'modify_time'    => 'Date',
      'hit_i'          => 'Number',
      'hit_mask_i'     => 'Number',
      'brief'          => 'Text',
      'keyword'        => 'Text',
      'status_id'      => 'ForeignKey',
      'member_level_i' => 'Number',
      'content_type_i' => 'Number',
      'body'           => 'Text',
      'flash_link'     => 'Text',
      'snapshot'       => 'Text',
      'snapshot_home'  => 'Text',
      'photo_group_id' => 'ForeignKey',
      'system_user_id' => 'ForeignKey',
    );
  }
}
